//
//  CssPointViewController.m
//  wuliangye
//
//  Created by yeeyuntech on 16/8/4.
//  Copyright © 2016年 jarze. All rights reserved.
//

#import "CssPointViewController.h"
#import "CssPointView.h"
#define RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]


@interface CssPointViewController ()
@property (weak, nonatomic) IBOutlet CssPointView *watchView;

@end

@implementation CssPointViewController

- (void)viewDidLoad {
    [super viewDidLoad];
     _watchView.maxValue = 300.0;
     _watchView.showRangeLabels = YES;
     _watchView.rangeValues = @[ @50,@90,@130,@240.0,@300];
     _watchView.rangeColors = @[ RGB(232, 111, 33),    RGB(232, 231, 33),  RGB(27, 202, 33),   RGB(231, 32, 43),    RGB(231, 150, 43) ];
     _watchView.rangeLabels = @[ @"VERY LOW",          @"LOW",             @"OK",              @"OVER FILL" ,@"PERFECT"];
    _watchView.unitOfMeasurement = @"psi";
    _watchView.showUnitOfMeasurement = YES;
    [NSTimer scheduledTimerWithTimeInterval:2.0
                                     target:self
                                   selector:@selector(gaugeUpdateTimer:)
                                   userInfo:nil
                                    repeats:YES];
}

-(void)gaugeUpdateTimer:(NSTimer *)timer
{
    _watchView.value = rand()%(int)_watchView.maxValue;
//    _watchView.value = rand()%(int)_watchView.maxValue;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
